<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use hg\apidoc\annotation as Apidoc;
use Illuminate\Support\Facades\Redis;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function test(){
        \GatewayClient\Gateway::$registerAddress = '127.0.0.1:1236';
        // $res = \GatewayClient\Gateway::sendToClient('7f00000108fc000000d3', '{"type": "update", "data": {"name": "张三", "aratar": "..."}}');

        // Redis::flushdb();
        // dd(Redis::get('websocket'));

        file_put_contents('./test.txt', request()->getContent(), FILE_APPEND);
      
     }

     public function bind(Request $request)
     {
        $data = $request->client_id;
        
        $data = json_decode($data, true);
        if ($data['msg'] == 'init') {
            $client_id = $data['data'];

            return $client_id;
        }
     }
}
